package com.study.forumsystemproject.service;

import com.study.forumsystemproject.model.Article;
import com.study.forumsystemproject.model.PageInfo;
import com.study.forumsystemproject.model.ResultPage;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface IArticleService {
    @Transactional
    void addArticle(Article article);
    /**
     * Description: 加载所有列表信息
     * return: Board列表
     * Author: xiaoxie
     * Date: 20:34 2024/8/17
     */
     PageInfo getAllArticles(ResultPage resultPage);
    /**
     * Description: 根据不同版块加载相应的列表信息
     * return: Board列表
     * Author: xiaoxie
     * Date: 20:34 2024/8/17
     */
     PageInfo getListByBoardId(Long boardId,ResultPage resultPage);

    /**
     * Description: selectDetailsByArticleId
     * Param: article id
     * return: Article对象
     * Author: xiaoxie
     * Date: 23:24 2024/8/17
    */
    Article selectDetailsByArticleId(HttpServletRequest request,Long id);

    /**
     * Description: modifyArticle
     * Param: article  id, title,content
     * return: void
     * Author: xiaoxie
     * Date: 10:36 2024/8/18
    */
    void modifyArticle(Long id,String title,String content);

    /**
     * Description: getArticleById
     * Param: article id
     * return: article
     * Author: xiaoxie
     * Date: 10:37 2024/8/18
    */
    Article getArticleById(Long id);
    /**
     * Description: UpvoteByArticleId
     * Param: article id
     * return: true 已点赞 false : 取消点赞
     * Author: xiaoxie
     * Date: 18:13 2024/8/18
    */
    Boolean UpvoteByArticleId(HttpServletRequest request,Long id);

    /**
     * Description: subArticle
     * Param: * @param article
     * return: void
     * Author: xiaoxie
     * Date: 20:34 2024/8/18
    */
    @Transactional
    void subArticle(Long id);

    /**
     * Description: addOneReply
     * Param: article id
     * return: void
     * Author: xiaoxie
     * Date: 9:57 2024/8/19
    */
    void addOneReply(Long id);

    /**
     * Description: 根据用户Id查询帖子列表信息
     * Param:  userId
     * return: 帖子列表
     * Author: xiaoxie
     * Date: 18:13 2024/8/19
     */
    List<Article> selectDetailsByUserId(Long userId);
}
